<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.systop.core.dao.support.Page"%>
<html>
<%@include file="/common/taglibs.jsp"%>
<head>
<title>我的收藏</title>
<link rel="stylesheet" type="text/css" href="${ctx}/styles/style.css">
<style type="text/css">
.tb{
	border-bottom: 1px dashed #D9D9D9;
}
.title{
	background-color:#FAFAFA;
	line-height: 30px;
	font-size: 14px;
	font-weight: bold;
}
input{
	border:1px solid #D9D9D9; 
}
</style>
<script type="text/javascript">
	function removeBook(favoriteId) {
		if(favoriteId != null && favoriteId != "") {
			location.href = "remove.do?model.id=" + favoriteId;
		}
	}
</script>
</head>
<body>
<table width="790" align="center">
	<tr>
		<s:form action="index.do" method="post">
			<td>&nbsp;图书名称：<s:textfield name="bookName"
				cssStyle="width:100px" />&nbsp; 
				年级：<s:select id="grade" list="gradeMap" name="bookGrade" headerKey="" headerValue="--选择年级--"
					cssStyle="width:120px"></s:select>&nbsp; 
				学科：<s:select id="subjectId" name="bookSubjectId" list="subjectList" listKey="sjId"
					listValue="sjName" headerKey="" headerValue="--选择学科--"
						cssStyle="width:120px" /> &nbsp;
				<input type="submit" value="查询" class="button" />
			</td>
		</s:form>
	</tr>
</table>
<table><tr><td height="1"></td></tr></table>
<div>
<table width="790" align="center" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #C0C0C0; ">
	<tr class="title">
		<td width="50" align="center">封面</td>
		<td width="400" align="center">图书名称</td>
		<td width="120">作者</td>
		<td width="120">学科</td>
		<td width="100"  align="center">操作</td>
	</tr>
	<c:forEach items="${items}" var="item" varStatus="status">
		<tr onmouseover="this.style.backgroundColor='#FFF7E2'" onmouseout="this.style.backgroundColor='#ffffff'">
			<td width="50" align="center">
			  <a href="${ctx}/book/view.do?model.id=${item.book.id}" target="_blank">
				<img alt="封面" width="30" height="32" id="imgphoto"
								src="<c:if test='${not empty item.book.coverPhoto}'>${ctx}${item.book.coverPhoto}</c:if>
							 <c:if test='${empty item.book.coverPhoto}'> ${ctx}/images/longtian/book_nophoto_big.gif</c:if>"/>
			 </a>
			</td>
			<td width="400">&nbsp;<a href="${ctx}/book/view.do?model.id=${item.book.id}" target="_blank">${item.book.name}</a></td>
			<td width="120">${item.book.author}</td>
			<td width="120">${item.book.subject.name}</td>
			<td width="100" align="center">
				<a href="${ctx}/book/view.do?model.id=${item.book.id}" target="_blank">查看</a> |
				<a href="#" onClick="removeBook(${item.id})">移除</a>
			</td>
		</tr>
	</c:forEach>
</table>
</div>
<table width="790" align="center">
  <tr><td align="right">
	<%
		Page p = (Page)request.getAttribute("page");
	%>
	<% if (p != null){ %>
	<div style="">
		<a href="${ctx}/favorite/index.do?pageSize=<%=p.getPageSize()%>&ec_p=1">首页</a>&nbsp;&nbsp;
		<% if (p.hasPreviousPage()){ %>
			<a href="${ctx}/favorite/index.do?pageSize=<%=p.getPageSize()%>&ec_p=<%=p.getPageNo()-1%>">上一页</a>
		<%}else{ %>
			<span class="disEnable">上一页</span>
		<%} %>&nbsp;&nbsp;
		<% if (p.getHasNextPage()){ %>
			<a href="${ctx}/favorite/index.do?pageSize=<%=p.getPageSize()%>&ec_p=<%=p.getPageNo()+1%>">下一页</a>
		<%}else{ %>
			<span class="disEnable">下一页</span>
		<%} %>&nbsp;&nbsp;
		<a href="${ctx}/favorite/index.do?pageSize=<%=p.getPageSize()%>&ec_p=<%=p.getPages()%>">尾页</a>&nbsp;&nbsp;
		第<span style="color:red;"><%=p.getPageNo()%></span>页/共<span style="color:red;"><%=p.getPages()%></span>页&nbsp;&nbsp;
		<input type="text" id="ec_p" name="ec_p" style="width:25px">
		<span style="cursor: pointer;" onclick="goPage()"><b>GO</b></span>
	</div>
	<script type="text/javascript">
	  function goPage(){
		var pageNo = document.getElementById('ec_p').value;
		if (pageNo != null && pageNo.length > 0){
			var pNo = <%=p.getPages()%>;
			if (!isNaN(pageNo)){
				if(pNo < pageNo){
					pageNo = pNo;
				}
				window.location.href = "${ctx}/favorite/index.do?pageSize=<%=p.getPageSize()%>&ec_p=" + pageNo;
			}else{
				alert("请输入正确的数字!");
			}
		}
	  }
	  window.parent.scrollTo(0, 0);
	</script>
	<%} %>
  </td></tr>
</table>
<br/>
</body>
</html>